<?php
class SayModel extends MetaModel
{
	protected $_validate  = array(
	array ('content','require','内容不能为空',1,'',1),
	);


	protected $_auto = array(
	array ('createtime','time',1,'function'),
	array ('status','1'),
	array ('user_id','userID',1,'function'),
	);
	
	/**
	 * 获取微博传入用户ID
	 * @param $arr 用户IDS
	 */
	function getMySays($arr,$limit=8)
	{
		return $this->query("select sz_say.id,sz_say.createtime,sz_say.content,sz_image.filename,sz_image.url,sz_user.id as uid,sz_user.cnname from sz_say,sz_image,sz_user where sz_say.status=1 and sz_user.image_id = sz_image.id and sz_say.user_id = sz_user.id and sz_say.user_id in ".$arr." order by sz_say.id desc limit 0,$limit"); 
	}
	
	function getSays($arr,$limit=8)
	{
		return $this->query("select sz_say.id,sz_say.createtime,sz_say.content,sz_image.filename,sz_image.url,sz_user.id as uid,sz_user.cnname from sz_say,sz_image,sz_user where sz_say.status=1 and sz_user.image_id = sz_image.id and sz_say.user_id = sz_user.id and sz_say.user_id in ".$arr." order by sz_say.id desc limit 0,$limit"); 
	}
}
?>